﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using School.Admission;

namespace School.Pages.Admission
{
    public partial class FatherStudentsResults : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }

        protected void lnkBtnOpenStudentResult_Click(object sender, EventArgs e)
        {
            Response.Redirect("../Admission/Reports/StudentResult.aspx?Id= " + Convert.ToString(ddlFatherStudents.SelectedValue));
        }
        protected void lnkBtnOpenExams_Click(object sender, EventArgs e)
        {
            Session["studentId"] = ddlFatherStudents.SelectedValue;
            Response.Redirect("/Admission/Reports/ShowStudentExamSchedule.aspx?Exam_Id=0");
            BindData();
        }
        void BindData()
        {
            int x = Convert.ToInt32(Session["fatherId"]);
            ddlFatherStudents.DataTextField = "Ar_FirstName";
            ddlFatherStudents.DataValueField = "Id";
            ddlFatherStudents.DataSource = Father.GetFatherstudents(Convert.ToInt32(Session["fatherId"]));
            ddlFatherStudents.DataBind();
            ddlFatherStudents.Items.Insert(0, new ListItem() { Value = "0", Text = "اختر الابن" });
        }
    }
}